using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._SpatialAnalystTools._SegmentationandClassification
{
    /// <summary>
    /// <para>Segment Mean Shift</para>
    /// <para>Groups into segments adjacent pixels that have similar spectral characteristics.</para>
    /// <para>将具有相似光谱特征的相邻像素分组为段。</para>
    /// </summary>    
    [DisplayName("Segment Mean Shift")]
    public class SegmentMeanShift : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public SegmentMeanShift()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_raster">
        /// <para>Input Raster</para>
        /// <para>The raster dataset to segment. This can be a multispectral or grayscale image.</para>
        /// <para>要分割的栅格数据集。这可以是多光谱或灰度图像。</para>
        /// </param>
        /// <param name="_out_raster_dataset">
        /// <para>Output Raster Dataset</para>
        /// <para><xdoc>
        ///   <para>Specify a name and extension for the output dataset.</para>
        ///   <para>If the input was a multispectral image, the output will be an 8-bit RGB image. If the input was a grayscale image, the output will be an 8-bit grayscale image.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定输出数据集的名称和扩展名。</para>
        ///   <para>如果输入是多光谱图像，则输出将是 8 位 RGB 图像。如果输入是灰度图像，则输出将是 8 位灰度图像。</para>
        /// </xdoc></para>
        /// </param>
        public SegmentMeanShift(object _in_raster, object _out_raster_dataset)
        {
            this._in_raster = _in_raster;
            this._out_raster_dataset = _out_raster_dataset;
        }
        public override string ToolboxName => "Spatial Analyst Tools";

        public override string ToolName => "Segment Mean Shift";

        public override string CallName => "sa.SegmentMeanShift";

        public override List<string> AcceptEnvironments => ["compression", "configKeyword", "extent", "geographicTransformations", "nodata", "outputCoordinateSystem", "parallelProcessingFactor", "pyramid", "rasterStatistics", "resamplingMethod", "scratchWorkspace", "snapRaster", "tileSize", "workspace"];

        public override object[] ParameterInfo => [_in_raster, _out_raster_dataset, _spectral_detail, _spatial_detail, _min_segment_size, _band_indexes, _max_segment_size];

        /// <summary>
        /// <para>Input Raster</para>
        /// <para>The raster dataset to segment. This can be a multispectral or grayscale image.</para>
        /// <para>要分割的栅格数据集。这可以是多光谱或灰度图像。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Raster")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_raster { get; set; }


        /// <summary>
        /// <para>Output Raster Dataset</para>
        /// <para><xdoc>
        ///   <para>Specify a name and extension for the output dataset.</para>
        ///   <para>If the input was a multispectral image, the output will be an 8-bit RGB image. If the input was a grayscale image, the output will be an 8-bit grayscale image.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定输出数据集的名称和扩展名。</para>
        ///   <para>如果输入是多光谱图像，则输出将是 8 位 RGB 图像。如果输入是灰度图像，则输出将是 8 位灰度图像。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Raster Dataset")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _out_raster_dataset { get; set; }


        /// <summary>
        /// <para>Spectral Detail</para>
        /// <para><xdoc>
        ///   <para>The level of importance given to the spectral differences of features in the imagery.</para>
        ///   <para>Valid values range from 1.0 to 20.0. A higher value is appropriate when there are features to classify separately that have similar spectral characteristics. Smaller values create spectrally smoother outputs. For example, with higher spectral detail in a forested scene, there will be greater discrimination between the tree species.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>对影像中要素的光谱差异的重要性级别。</para>
        ///   <para>有效值范围为 1.0 到 20.0。当存在要单独分类的具有相似光谱特征的特征时，较高的值是合适的。值越小，输出越平滑。例如，在森林场景中，光谱细节越高，树种之间的区分度就越大。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Spectral Detail")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double _spectral_detail { get; set; } = 15.5;


        /// <summary>
        /// <para>Spatial Detail</para>
        /// <para><xdoc>
        ///   <para>The level of importance given to the proximity between features in the imagery.</para>
        ///   <para>Valid values range from 1.0 to 20. A higher value is appropriate for a scene in which the features of interest are small and clustered together. Smaller values create spatially smoother outputs. For example, in an urban scene, impervious surfaces can be classified using a smaller spatial detail, or buildings and roads can be classified as separate classes using a higher spatial detail.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>对影像中要素之间的邻近性赋予的重要性级别。</para>
        ///   <para>有效值范围为 1.0 到 20。较高的值适用于感兴趣要素较小且聚集在一起的场景。值越小，输出空间越平滑。例如，在城市场景中，可以使用较小的空间细节对不透水表面进行分类，或者可以使用较高的空间细节将建筑物和道路分类为单独的类。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Spatial Detail")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long _spatial_detail { get; set; } = 15;


        /// <summary>
        /// <para>Minimum Segment Size In Pixels</para>
        /// <para><xdoc>
        ///   <para>The minimum size of a segment. Merge segments smaller than this size with their best fitting neighbor segment. This is related to the minimum mapping unit for your project.</para>
        ///   <para>Units are in pixels.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>段的最小大小。将小于此大小的线段与其最适合的相邻线段合并。这与项目的最小映射单位有关。</para>
        ///   <para>单位以像素为单位。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Minimum Segment Size In Pixels")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long _min_segment_size { get; set; } = 20;


        /// <summary>
        /// <para>Band Indexes</para>
        /// <para><xdoc>
        ///   <para>The bands that will be used to segment the imagery, separated by a space. If no band indexes are specified, they are determined by the following criteria:
        ///   <bulletList>
        ///     <bullet_item>If the raster has only 3 bands, those 3 bands are used  </bullet_item><para/>
        ///     <bullet_item>If the raster has more than 3 bands, the tool assigns the red, green, and blue bands according to the raster's properties.  </bullet_item><para/>
        ///     <bullet_item>If the red, green, and blue bands are not identified in the raster dataset's properties, bands 1, 2, and 3 are used.  </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        ///   <para>The band order will not change the result.</para>
        ///   <para>Select bands that offer the most differentiation between the features of interest.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        /// <para>将用于分割影像的波段，由空格分隔。如果未指定波段索引，则由以下条件确定：
        ///   <bulletList>
        ///     <bullet_item>如果栅格只有 3 个波段，则使用这 3 个波段</bullet_item><para/>
        ///     <bullet_item>如果栅格具有 3 个以上的波段，则工具将根据栅格的属性分配红色、绿色和蓝色波段。</bullet_item><para/>
        ///     <bullet_item>如果未在栅格数据集的属性中标识红色、绿色和蓝色波段，则使用波段 1、2 和 3。</bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        ///   <para>波段顺序不会改变结果。</para>
        ///   <para>选择在感兴趣特征之间提供最大差异的波段。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Band Indexes")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _band_indexes { get; set; } = null;


        /// <summary>
        /// <para>Maximum Segment Size In Pixels</para>
        /// <para><xdoc>
        ///   <para>The maximum size of a segment. Segments that are larger than the specified size will be divided. Use this parameter to prevent artifacts in the output raster resulting from large segments.</para>
        ///   <para>Units are in pixels.</para>
        ///   <para>The default value is -1, meaning there is no limit on the segment size.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>段的最大大小。大于指定大小的段将被划分。使用此参数可防止输出栅格中因大段而产生伪影。</para>
        ///   <para>单位以像素为单位。</para>
        ///   <para>默认值为 -1，表示对段大小没有限制。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Maximum Segment Size In Pixels")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long _max_segment_size { get; set; } = -1;


        public SegmentMeanShift SetEnv(object compression = null, object configKeyword = null, object extent = null, object geographicTransformations = null, object nodata = null, object outputCoordinateSystem = null, object parallelProcessingFactor = null, object pyramid = null, object rasterStatistics = null, object resamplingMethod = null, object scratchWorkspace = null, object snapRaster = null, double[] tileSize = null, object workspace = null)
        {
            base.SetEnv(compression: compression, configKeyword: configKeyword, extent: extent, geographicTransformations: geographicTransformations, nodata: nodata, outputCoordinateSystem: outputCoordinateSystem, parallelProcessingFactor: parallelProcessingFactor, pyramid: pyramid, rasterStatistics: rasterStatistics, resamplingMethod: resamplingMethod, scratchWorkspace: scratchWorkspace, snapRaster: snapRaster, tileSize: tileSize, workspace: workspace);
            return this;
        }

    }

}